Skip to content

功能(WK3):增加本机天气处理并统一多平台代理架构与构建 - #108

Open
patrickyanxxxxx wants to merge 42 commits into
NSRingo:mainfrom
patrickyanxxxxx:main
Open

patrickyanxxxxx wants to merge 42 commits into
NSRingo:mainfrom
patrickyanxxxxx:main

Conversation

@patrickyanxxxxx

@patrickyanxxxxx patrickyanxxxxx commented Nov 5, 2026 •

Copy link
Copy Markdown

变更目的

在 v3.3.2(c40e8f8a)基础上增加 iOS 27 WK3 本机处理,保留现有 WK2 请求、响应与 Hono 入口。WK3 使用独立编解码与有界写入,避免仅扩展 URL 正则后误用 WK2 字段和枚举。

主要变更

  • 空气质量:支持已验证的 WK3 同标准更新、原国标转彩云美标,以及香港 Apple 缺失 AQ 时的条件补入;保留其他天气槽及未知字段。
  • 分钟降水、同源同标准的昨日空气等级比较,以及严格匹配 Apple 原事件 ID 的预警补全和原生详情;不支持的结构或匹配失败时回退。
  • 将五平台共用业务、请求/响应入口、参数、HTTP 封装与路由放入 src/wk3/;客户端对象适配保留在 src/platform/,Egern 与其他平台不再反向依赖 Egern 专属业务目录。
  • 提供上游 12 个 AQ 算法选项(含 None),默认内置算法 WAQI_InstantCast_US;今日/昨日指数来源默认 ColorfulCloudsUS。只有选择 Calculate 才执行内置计算。
  • 增加 Egern、Surge、Loon、Stash、Quantumult X 模块模板及平台 JS 构建,统一版本化输出为十份 JS、五份模块;保留原上游构建产物。
  • 修复 Fork 环境下 checkout 空令牌、包读取权限及令牌回退问题,使用 Node 22 避免 latest 拉取 Node 27 alpha / npm 12 后触发 EALLOWREMOTE。没有新增依赖。
  • v3.3.4 修正美标边界截断、超量程连续性、AQHI 单位/缺输入及 CO 幂等转换;遵循空目标、None、昨日来源及实际变化比较语义。参考 PR fix(loon): 兼容 WK3 主天气并修复空气质量与预警数据 #107 的修复保留 Horatio/Apache-2.0 来源,未引入其 JSON 协商、缓存或新依赖。
  • 模块设置名称和帮助对齐上游;五平台共用等级日志,显示开始、处理摘要及结束,保留 OFF 与令牌遮蔽;修复参数超时和 Surge/Loon/Stash 响应阶段的 $done 结构。
  • README/CHANGELOG 补充架构、默认配置、客户端适配状态及已知限制。

验证

  • 完整旧入口/WK3/模块/日志/平台/发行回归已纳入 CI,正式 v3.3.4 标签执行 338/338 通过、0 跳过。
  • Surge 合成 WK3 回放实际调用模拟来源,将 AQI 60 转为 87;覆盖 bodyBytes、参数传递、未知结构保留和路由互斥等场景。
  • 修复分支 Build及正式标签构建实际执行完整回归、旧入口与五平台构建、附件检查并成功。
  • Fork 已发布 v3.3.4(保留 v3.3.3);十五份 WK3 附件均完成匿名 HTTP 200 下载核验,五份模块与标签源码生成结果一致,25 条脚本引用均有对应附件。
  • 用户反馈 v3.3.3 Egern 实机试用正常;未逐项验收所有边界,v3.3.4 补丁尚无新设备反馈。Surge/Loon/Stash 尚无真实客户端验收结论。

已知限制与上游审查事项

  • WK3 当前/逐日/逐小时天气尚缺经真实样本验证的 codec,保持 Apple 原始数据,不能视为已完整移植 WK2 天气替换能力。
  • Quantumult X 二进制天气仅透传,不执行 WK3 AQ/分钟雨等转换,且没有模块交互参数界面;Shadowrocket 无 WK3 本机模块。
  • 12 个 AQ 选项不意味着全部目标标准都能写入 WK3;未验证的跨标准转换透传,单组 InstantCast 输入不等同于 EPA NowCast 时间加权,AQHI 不自动建立三小时均值。
  • 部分 WK2 codec/数据源源码仍为隔离副本,尚未与上游同名类完全去重;v3.3.4 同时修复两套算法类;没有为删减代码取消原有保护。
  • 新增 WK3 模块的发布地址目前指向 Fork,仓库内 Egern 兼容模块仍指向既有 Gist。若由上游发行,需在维护者确认后调整发布仓库/来源及 README 中 Fork 专属说明;本 PR 未修改任何现用 Gist。

提交记录

本 PR 包含 26 个中文独立提交,来源 patrickyanxxxxx/WeatherKit-WK3:main,HEAD 389f0afe85a27304be99cdcb00e6758af4f4a736。未压缩或重写本次提交历史。

请保留完整的独立提交记录,采用保留提交的合并方式,不要 Squash merge,便于逐项审查与后续维护。

@VirgilClyne

Copy link
Copy Markdown
Member

叹为观止,惊为天人

mist-whisper added a commit to mist-whisper/WeatherKit that referenced this pull request Nov 5, 2026
VirgilClyne added a commit that referenced this pull request Nov 6, 2026
- WeatherKit2/ForecastNextHour import the named WK2 namespace; shared
  constructors move to WK2.Common.ForecastMinute / WK2.Common.UUID.
- WeatherKit3 gains a small FlatBufferRootProcessor subclass overriding only
  decode: a requested AQ child that fails to decode now yields null so the
  response keeps Apple's original package; a genuinely missing AQ still
  allows backfill. Encoding and other processor behavior is inherited.
- Response.dev drops direct protocol imports, raw generated-table checks
  and enum-table selection; MatchEnum takes the business object and the
  request version and picks WK2/WK3 enum tables internally.
- Port the shared PR #107/#108 fixes: epsilon-tolerant boundary ceiling in
  #CeilByPrecision, and idempotent QWeather CO unit handling in
  FixPollutantsUnits (explicit mg/m3 label, or the mislabeled Apple product
  only via appleProduct) with regression tests.
- Tests migrate static/dynamic protocol imports to the three-namespace API.
VirgilClyne added a commit that referenced this pull request Nov 6, 2026
- 拆分 WeatherKit 为 WeatherKit2/WeatherKit3 两个版本处理器,均基于
  @nsnanocat/flatbuffer-root 配置通用根表编解码;WK3 仅注册 AQ 根槽,
  其余产品保持原始 arena。
- WeatherKit3Processor 子类提供 decode 失败边界:已请求 AQ 读取或解码
  失败时返回 null 保留原包,物理缺失允许补齐(基于包的 decodeWithReport
  分类报告);checkFields 使用包的 inspectTable 做已验证字段数校验。
- 升级 @NSRingo/weatherkit 至 2.0.0(Common/WK2/WK3 命名空间)与
  @nsnanocat/flatbuffer-root 至 ^1.1.0;共用构造器经 WK2.Common 引用。
- Response.dev 移除协议包直接导入、枚举表选择与原始生成表检查;
  MatchEnum 改为按请求版本内部选择枚举表。
- 移植 PR #107/#108 共同确认的修复:#CeilByPrecision 取整 EPSILON 容差、
  FixPollutantsUnits 的 CO 单位幂等转换(appleProduct 入口)。
- WK3 与 WK2 的函数顺序、命名、参数排版对齐;两个 class 均补 JSDoc。
- 新增平台模拟回放测试(dist bundle、Surge 语义模拟)与 CO 单位回归。
VirgilClyne added a commit that referenced this pull request Nov 6, 2026
- 拆分 WeatherKit 为 WeatherKit2/WeatherKit3 两个版本处理器,均基于
  @nsnanocat/flatbuffer-root 配置通用根表编解码;WK3 仅注册 AQ 根槽,
  其余产品保持原始 arena。
- WeatherKit3Processor 子类提供 decode 失败边界:已请求 AQ 读取或解码
  失败时返回 null 保留原包,物理缺失允许补齐(基于包的 decodeWithReport
  分类报告);checkFields 使用包的 inspectTable 做已验证字段数校验。
- 升级 @NSRingo/weatherkit 至 2.0.0(Common/WK2/WK3 命名空间)与
  @nsnanocat/flatbuffer-root 至 ^1.1.0;共用构造器经 WK2.Common 引用。
- Response.dev 移除协议包直接导入、枚举表选择与原始生成表检查;
  MatchEnum 改为按请求版本内部选择枚举表。
- 移植 PR #107/#108 共同确认的修复:#CeilByPrecision 取整 EPSILON 容差、
  FixPollutantsUnits 的 CO 单位幂等转换(appleProduct 入口)。
- WK3 与 WK2 的函数顺序、命名、参数排版对齐;两个 class 均补 JSDoc。
- 新增平台模拟回放测试(dist bundle、Surge 语义模拟)与 CO 单位回归。
VirgilClyne added a commit that referenced this pull request Nov 6, 2026
- 拆分 WeatherKit 为 WeatherKit2/WeatherKit3 两个版本处理器,均基于
  @nsnanocat/flatbuffer-root 配置通用根表编解码;WK3 仅注册 AQ 根槽,
  其余产品保持原始 arena。
- WeatherKit3Processor 子类提供 decode 失败边界:已请求 AQ 读取或解码
  失败时返回 null 保留原包,物理缺失允许补齐(基于包的 decodeWithReport
  分类报告);checkFields 使用包的 inspectTable 做已验证字段数校验。
- 升级 @NSRingo/weatherkit 至 2.0.0(Common/WK2/WK3 命名空间)与
  @nsnanocat/flatbuffer-root 至 ^1.1.0;共用构造器经 WK2.Common 引用。
- Response.dev 移除协议包直接导入、枚举表选择与原始生成表检查;
  MatchEnum 改为按请求版本内部选择枚举表。
- 移植 PR #107/#108 共同确认的修复:#CeilByPrecision 取整 EPSILON 容差、
  FixPollutantsUnits 的 CO 单位幂等转换(appleProduct 入口)。
- WK3 与 WK2 的函数顺序、命名、参数排版对齐;两个 class 均补 JSDoc。
- 新增平台模拟回放测试(dist bundle、Surge 语义模拟)与 CO 单位回归。
VirgilClyne added a commit that referenced this pull request Nov 6, 2026
- 拆分 WeatherKit 为 WeatherKit2/WeatherKit3 两个版本处理器,均基于
  @nsnanocat/flatbuffer-root 配置通用根表编解码;WK3 仅注册 AQ 根槽,
  其余产品保持原始 arena。
- WeatherKit3Processor 子类提供 decode 失败边界:已请求 AQ 读取或解码
  失败时返回 null 保留原包,物理缺失允许补齐(基于包的 decodeWithReport
  分类报告);checkFields 使用包的 inspectTable 做已验证字段数校验。
- 共用构造器经 WK2.Common 引用;Response.dev 移除协议包直接导入、
  枚举表选择与原始生成表检查;MatchEnum 改为按请求版本内部选择枚举表。
- 移植 PR #107/#108 共同确认的修复:#CeilByPrecision 取整 EPSILON 容差、
  FixPollutantsUnits 的 CO 单位幂等转换(appleProduct 入口)。
- WK3 与 WK2 的函数顺序、命名、参数排版对齐;两个 class 均补 JSDoc。
- 新增平台模拟回放测试(dist bundle、Surge 语义模拟)与 CO 单位回归。
- dev 模块模板的 weather 规则拆分为独立的 v2/v3 条目并修正命名。
VirgilClyne added a commit that referenced this pull request Nov 7, 2026
按 PR #108 实机验证的结论:业务摘要恒为单条件分段,单元素 u8
向量与 u16 向量字节一致,可安全写入槽位 2;未知降水类型抛错
由处理器隔离。多元素向量的元素宽度仍未验证,schema 维持保留。

全量 134 项通过,dev bundle 回放 5/5 通过。
hhhoratioxu added a commit to hhhoratioxu/WeatherKit that referenced this pull request Nov 14, 2026
Remove the nine optional cache, coalescing, request budget, cooldown,
statistics, region fallback and alternate-provider controls. Keep original
source settings, per-request timeouts and Apple failure fallback.

Preserve unavailable Apple warnings unless enrichment changes actual data;
retain opaque JSON containers and a normalized Apple fallback on overflow.
Cover periodic and minute-rain edge cases and validate AQ comparison levels.

Add source-native warning language preferences with Auto preserving old
behavior. Normalize reserved expiry values without changing genuine times
or manufacturing an event end. Preserve the original twelve defaults.

Keep the PR's upstream release URLs, original display name, independent
.loon.bundle.js files, package/lockfile policy and attribution. Retain all
seven existing commits. Credit the referenced input-validation direction
from Patrick Yan (NSRingo#108, 24c3f93) and known-container traversal from
hhh2210 (NSRingo#110, f4676fe), as documented in the source.

Validation: 430/430 regressions; 52 compiled Loon scenarios; 15 rewrite/jq
checks; 13 declarations with all twelve original defaults preserved.
Native evidence and remaining limits are documented separately.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants